﻿using System;
using ApplicationLibrary.SqlConnector;

namespace Vintner.Sales.ModuleData
{
    #region VI_SaleInvoices

    public class VI_SaleInvoices : Table
    {
        public static string Name = "VI_SaleInvoices";

        public static Column<bool> IsDado = new Column<bool>(Name, "", "IsDado", false);
        public static Column<string> InvoiceNo = new Column<string>(Name, Properties.Resources.T_InvoiceNo, "SaleNo", LEN.CODE, false);
        public static Column<DateTime> ReleaseDate = new Column<DateTime>(Name, Properties.Resources.T_ReleaseDate, "ReleaseDate");
        public static Column<string> Customer = new Column<string>(Name, Properties.Resources.T_Code, "Code", LEN.CODE, false);
        public static Column<string> Description = new Column<string>(Name, Properties.Resources.T_Description, "Description", LEN.BIG_DESCRIPTION);
        public static Column<string> Address = new Column<string>(Name, Properties.Resources.T_Address, "Address", 128);
        public static Column<string> ZipCode = new Column<string>(Name, Properties.Resources.T_ZipCode, "ZipCode", 5);
        public static Column<string> City = new Column<string>(Name, Properties.Resources.T_City, "City", 35);
        public static Column<string> County = new Column<string>(Name, Properties.Resources.T_County, "County", 2);

        public static Column<string> Title = new Column<string>(Name, Properties.Resources.T_Title, "Title", LEN.CODE);

        public static Column<string> TaxNo = new Column<string>(Name, Properties.Resources.T_TaxNo, "TaxNo", 11);
        public static Column<string> FiscalCode = new Column<string>(Name, Properties.Resources.T_FiscalCode, "FiscalCode", LEN.CODE);
        public static Column<string> Payment = new Column<string>(Name, "", "Payment", LEN.CODE);

        public static Column<int> PackagesNo = new Column<int>(Name, "", "PackagesNo");
        public static Column<double> LitresNo = new Column<double>(Name, "", "LitresNo");

        public static Column<string> Appearance = new Column<string>(Name, "", "Appearance", LEN.BIG_DESCRIPTION);
        public static Column<string> Transport = new Column<string>(Name, "", "Transport", LEN.CODE);
        public static Column<string> DestGoods = new Column<string>(Name, "", "DestGoods", LEN.BIG_DESCRIPTION);
        public static Column<DateTime> TransportDate = new Column<DateTime>(Name, "", "TransportDate");

        public override iColumn ForeignKey
        {
            get { return InvoiceNo; }
        }

        public VI_SaleInvoices()
        {
            VisibleInRadar(new iColumn[] { InvoiceNo, Customer, Description });
            Tablename = Name;
            DefineKey(new iColumn[] { IsDado, InvoiceNo });
        }
    }

    #endregion

    #region VI_SaleInvoicesDetails

    public class VI_SaleInvoicesDetails : Table
    {
        public static string Name = "VI_SaleInvoicesDetails";
        public static Column<bool> IsDado = new Column<bool>(Name, "", "IsDado", false);
        public static Column<string> InvoiceNo = new Column<string>(Name, "", "SaleNo", LEN.CODE, false);
        public static Column<int> Line = new Column<int>(Name, "", "Line", false);
        public static Column<string> Item = new Column<string>(Name, "", "Item", LEN.LONG_CODE);
        public static Column<string> Description = new Column<string>(Name, "", "Description", LEN.BIG_DESCRIPTION);
        public static Column<string> Category = new Column<string>(Name, "", "Category", LEN.CODE);

        //public static Column<string> DescCategory = new Column<string>(Name, "", "DescCategory", LEN.CODE);
        public static Column<double> Price = new Column<double>(Name, "", "Price");

        public static Column<string> TaxCode = new Column<string>(Name, "", "TaxCode", LEN.CODE);
        public static Column<double> Quantity = new Column<double>(Name, "", "Quantity");
        public static Column<double> Total = new Column<double>(Name, "", "Total");
        public static Column<double> Litres = new Column<double>(Name, "", "Litres");
        public static Column<string> Lot = new Column<string>(Name, "", "Lot", LEN.CODE);

        public override iColumn ForeignKey
        {
            get { return Item; }
        }

        public VI_SaleInvoicesDetails()
        {
            Tablename = Name;
            DefineKey(new iColumn[] { IsDado, InvoiceNo, Line });
        }
    }

    #endregion
}